#ifndef TESTMAINWINDOW_H
#define TESTMAINWINDOW_H

#include <QMainWindow>

namespace Ui {
    class TestMainWindow;
}

class MP3PCMBuffer;
class PCMGenerator;
class ShredmateEngine;
class QListWidgetItem;
class Timeline;

class TestMainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit TestMainWindow(QWidget *parent = 0);
    ~TestMainWindow();

    static const int DataStreamVersion = 2;

protected:
    void closeEvent(QCloseEvent* event);

private slots:
    void on_pushButtonOpen_clicked();

    void on_pushButtonPlay_clicked();

    void on_pushButtonStop_clicked();

    void on_pushButtonTogglePause_clicked();

    void handleNotify();

    //void on_progressBar_adjusted(qint64 position);

    void on_checkBoxLooping_toggled(bool checked);

    void on_pushButtonAddMarker_clicked();

    void on_pushButtonRemoveMarker_clicked();

    void on_pushButtonSeekToMarker_clicked();

    void on_pushButtonAddRange_clicked();

    void on_pushButtonSetAsActiveRange_clicked();

    void on_listWidgetRanges_itemSelectionChanged();

    void on_pushButtonRemoveRange_clicked();

    void on_pushButtonAddRangeAndSetActive_clicked();

    void on_pushButtonResetActiveRange_clicked();

    void on_pushButtonReplaceMarker_clicked();

    void handleAdjustedManually(qint64 position);

    void handleSelectedMarkersChanged();
    void handleFocusedMarkerChanged();

    void updateRanges();

    void focusPreviousMarker();
    void focusNextMarker();

private:
    void updateMarkers();
    void updateActiveRange();

    void storeEngineState();
    void restoreEngineState();

private:
    Ui::TestMainWindow *ui;
    Timeline* m_timeline;

    MP3PCMBuffer* m_pcmBuffer;
    ShredmateEngine* m_engine;
};

#endif // TESTMAINWINDOW_H
